<template>
  <div>
    <div class="bos">
      <div class="boa">
        <div class="biaoT">
          <img src="@/assets/imgSrc/biaoTou.png" alt="" />
          <div class="biaoTZT">个人订阅</div>
        </div>
        <div class="gunD">
          <div class="box" v-for="(item, index) in arr" :key="item.id" @mouseover="dowmloadover(index)"
            @mouseleave="downloadleave(index)" :class="isAcitive === index ? 'isAcitive' : ''"
            @click="lookorgDetail(item, index)">
            <div class="boxLeft">
              <img src="@/assets/imgSrc/huangdian.png" alt="" />
            </div>
            <div class="boxRight">
              <div class="boxRightOne">{{ item.title }}</div>
              <div class="boxRightTwo">
                <span class="boxRight-spanOne">来源:{{ item.typeNo }}</span>
                <span>{{ item.createDate }}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { dateTypeFormat } from '@/utils/dateFormat'
export default {
  data() {
    return {
      getIndex: 0,
      isAcitive: false, // 移入变色
      arr: [

      ],
    }
  },

  mounted() {
    this.init()
  },

  methods: {
    init() {
      this.search()
    },
    search() {
      this.$api.GET('/modules/subscribeInfo/pageList').then(res => {
        res.data.forEach(item => {
          item.createDate = dateTypeFormat('YYYY-mm-dd HH:MM:SS', new Date(item.createDate));
        });
        this.arr = res.data
      })
    },
    // 鼠标点击事件 给变量赋值当前index
    lookorgDetail(item, index) {
      this.isAcitive = index;
      this.$router.push('/content/subscribeInfo')
    },
    // 鼠标移入赋值index 
    dowmloadover(index) {
      this.isAcitive = index
      console.log(index);
    },
    // 鼠标移出 
    downloadleave(index) {
      this.isAcitive = false
    },

  }
};
</script>

<style lang="less" scoped>
.isAcitive {
  cursor: pointer; // 鼠标小手
  background: #0031B4 !important;
}

.bos {
  margin: 0px 0 15px 0px;
  border: 2px solid #0044ff;
  border-radius: 10px;
  padding: 0px 0 15px 0;
  box-shadow: inset 0px 0px 10px 34px rgba(3, 9, 90, 60%);
  position: relative;
}

.biaoT {

  text-align: center;
  position: relative;
  top: -5px;
  height: 60px;

  img {
    width: 300px;
  }

  .biaoTZT {
    color: #fff;
    position: relative;
    top: -62px;
    font-size: 21px;
    font-weight: 600;
  }
}

.gunD {
  overflow: auto;
  height: 310px;
  // padding-top: 15px;
}

::-webkit-scrollbar {
  width: 0;
  height: 10px;
}

.box {
  display: flex;
  padding: 10px 25px;
  background-color: rgba(0, 15, 70, 0.8);
  border-radius: 10px;
  margin-bottom: 10px;
  transition: background-color 0.3s ease;
  margin: 10px 20px;

  .boxLeft {
    padding: 0px 15px 0 0;
  }

  .boxRight {
    .boxRightOne {
      font-size: 14px;
      font-weight: 500;
      color: #fff;
      padding-bottom: 10px;
      // width: 330px;
      //     /* 设置元素的宽度 */
      white-space: nowrap;
      //     /* 禁止文字换行 */
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .boxRightTwo {
      font-size: 15px;
      color: #8c93a1;

      .boxRight-spanOne {
        color: #50b4d2;
        font-weight: 600;
        padding-right: 10px;
      }
    }
  }
}
</style>